package cn.edu.njpi.排序;

/**
 * @author 朱宗辉
 * @version V1.0
 * @Package cn.edu.njpi.排序
 * @date 2021/7/30 20:12
 */
public class 选择 {
    public static void main(String[] args) {
        int[] i = {1, 3, 41, 32, 54, 6, 45};
        for (int a = 0; a < i.length; a++) {
            int n = 0;
            int m = 0;
            for (int b = a; b < i.length; b++) {
                if (b == a || i[b] < n) {
                    n = i[b];
                    m = b;
                }
            }
            int x = i[a];
            i[a] = n;
            i[m] = x;
        }

        for (int i1 : i) {
            System.out.print(i1 + "\t");
        }
    }
}
